package com.longge;

public class CheckPerfectNumber {
    public boolean checkPerfectNumber(int num) {

        if (num <= 1) return false;

        int sum = 0;
        for (int i = 1; i * i < num; i++) {
            if (num % i == 0) {
                sum += i;
                int j = num / i;
                if (j != i&&j!=num) {
                    sum += j;
                }
            }
        }
        return sum == num;

    }
}
